package org.example.service;

import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.example.config.Configurations;

import java.beans.PropertyVetoException;


public class DatasourceXml {

    private Configurations configuration;

    public DatasourceXml(Configurations configuration) {
        this.configuration = configuration;
    }

    public void parse() throws PropertyVetoException {
        ComboPooledDataSource dataSource= new ComboPooledDataSource();
        dataSource.setDriverClass("com.mysql.cj.jdbc.Driver");

        dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/ds0");

        dataSource.setUser("root");
        dataSource.setPassword("root");

        configuration.setDataSource(dataSource);
    }
}
